package com.ydzh.kfqgwvisitor.tool;

import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;

import java.util.HashMap;
import java.util.Map;

public class GetCameraPreviewURL {

    /**
     * `
     * 能力开放平台的网站路径
     */
    public static final String ARTEMIS_PATH = "/artemis";

    /***
     * 配置基本 参数
     * @param host 网关服务器ip端口
     * @param appKey  秘钥appkey
     * @param appSecret // 秘钥appSecret
     */
    public GetCameraPreviewURL(String host, String appKey, String appSecret) {
        /**
         * STEP1：设置平台参数，根据实际情况,设置host appkey appsecret 三个参数.
         */
        ArtemisConfig.host = host; // artemis网关服务器ip端口
        ArtemisConfig.appKey = appKey;  // 秘钥appkey
        ArtemisConfig.appSecret = appSecret;// 秘钥appSecret

    }

    public String doPost(String pathurl, String jsonBody) {

        Map<String, String> path = new HashMap<String, String>(2) {
            {
                put("http://", pathurl);//根据现场环境部署确认是http还是https
            }
        };
        String contentType = "application/json";
        return ArtemisHttpUtil.doPostStringArtemis(path, jsonBody, null, null, contentType, null);// post请求application/json类型参数
    }
}
